home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
archiver
/
ncmp424s.zoo
/
build
< prev
next >
Wrap
Text File
|
1993-03-06
|
20KB
|
843 lines
:
#!/bin/sh
#
version="4.2.4"
echo "Build (N)compress ${version}"
CLS=`sh -c 'tput clear' 2>/dev/null`
if expr `echo "foo\c"` : '.*c' >/dev/null
then
n='-n'
c=''
else
n=''
c='\c'
fi
trap 'rm -f /tmp/sh$$.tm* /tmp/sh$$.f* /tmp/sh$$.log /tmp/sh*.c' 0
trap 'set +x ; exit 1' 1 2 15
[ -f compress.def ] && . ./compress.def
while true
do
if [ "${DEFINED}" = yes ]
then
echo "${CLS} Build (N)compress ${version}
1. Directory to install compress in: ${BINDIR}
manual in : ${MANDIR}
2. Memory free for compress : ${USERMEM}
3. Input/Output buffer size : ${IBUFSIZ} ${OBUFSIZ}
4. C Compiler : ${CC}
5. Compiler options : ${CCOPT:---none--}
6. Libary options : ${LBOPT:---none--}
7. Special options for your system : ${EXTRA:---none--}
8. Number of register variable : ${REGISTERS}
9. Symbolic links : ${LSTAT}
10. Use include <utime.h> : ${UTIME_H}"
if [ ".${DIRENT}" = .yes ]
then
echo "11. Your system support dirent.h"
else
if [ ".${SYSDIR}" = .yes -a ".${DIRENT}" != .yes ]
then
echo "11. Your system support sys/dir.h"
else
echo "11. No directory support -r disabled."
fi
fi
echo "12. Word must start at even addres: ${NOALLIGN}, Bytorder on your system: ${BYTEORDER} (1=msb)"
echo "
d. Set default settings mkshar. Create shell archive
c. Compile compress mktar. Create tar archive
t. Test compress cleanup. Cleanup
i. Install compress genmake. Generate makefile
q. Stop
"
echo ${n} " Choice [1..10,d,c,t,i,q,mkshar,mktar,cleanup] : ${c}"
(
echo "# Current parameters."
for var in CC CCOPT LBOPT BINDIR MANDIR DIRENT SYSDIR IBUFSIZ \
OBUFSIZ USERMEM REGISTERS LSTAT BYTEORDER NOALLIGN \
EXTRA DEFINED UTIME_H
do
echo "${var}='`eval echo \$\{${var}\}`'"
done
) >compress.def
read choice var1 var2 var3 var4 varr
echo ""
else
choice=D
fi
case "${choice}" in
1)
if [ ".${var1}" = . ]
then
echo ${n} "Directory to install compress in (default:${BINDIR}) ? ${c}"
read var1 dummy
fi
BINDIR="${var1:-${BINDIR}}"
if [ ".${var2}" = . ]
then
echo ${n} "Directory to install manuals in (default:${MANDIR}) ? ${c}"
read var2 dummy
fi
MANDIR="${var2:-${MANDIR}}"
;;
2)
if [ ".${var1}" = . ]
then
echo "Compress use a lot of memory, the more memory it can just the faster"
echo "the programm is and the better compression is."
echo ${n} "Memory free for compress (default:${USERMEM}) ? ${c}"
read var1 dummy
fi
USERMEM="${var1:-${USERMEM}}"
;;
3)
if [ ".${var1}" = . ]
then
echo "For input and output compress use buffers. A bigger buffer reduce"
echo "system (kernel) overhead. If your system is a 16 bits system don't"
echo "make the buffers bigger than 2048 bytes. The default 2048 is in"
echo "most cases a good answer."
echo ${n} "Best input buffer size (default:${IBUFSIZ}) ? ${c}"
read var1 var2 dummy
if [ ".${var2}" = . ]
then
echo ${n} "Best output buffer size (default:${OBUFSIZ}) ? ${c}"
read D dummy
fi
fi
var2="${var2:-${var1}}"
IBUFSIZ="${var1:-${IBUFSIZ}}"
OBUFSIZ="${var2:-${OBUFSIZ}}"
;;
4)
if [ ".${var1}" = . ]
then
echo "C compiler to use for compilation (must by cc compatible)".
echo ${n} "C Compiler (default:${CC}) ? ${c}"
read var1 dummy
fi
CC="${var1:-${CC}}"
;;
5)
if [ ".${var1}" = . ]
then
echo ${n} "Compiler options (default:${CCOPT:-none}) ? ${c}"
read var1
fi
[ ".${var1}" != . ] && CCOPT="${var1} ${var2} ${var3} ${var4} ${varr}"
;;
6)
if [ ".${var1}" = . ]
then
echo ${n} "Libary options (default:${LBOPT:-none}) ? ${c}"
read var1
fi
[ ".${var1}" != . ] && LBOPT="${var1} ${var2} ${var3} ${var4} ${varr}"
;;
7)
if [ ".${var1}" = . ]
then
echo "Some system needs extra defines see README"
echo ${n} "Special for your system (default:${EXTRA:-none}) ? ${c}"
read var1
fi
[ ".${var1}" != . ] && EXTRA="${var1} ${var2} ${var3} ${var4} ${varr}"
;;
8)
if [ ".${var1}" = . ]
then
echo ${n} "Number of register variable (default:${REGISTERS}) ? ${c}"
read var1 dummy
fi
REGISTERS="${var1:-${REGISTERS}}"
;;
9)
if [ ".${var1}" = . ]
then
echo ${n} "Symbolic links (default:${LSTAT}) ? ${c}"
read var1 dummy
fi
case "${var1:-${DIRENT}}" in
y|Y|yes|YES) LSTAT=yes; ;;
*) LSTAT=no; ;;
esac
;;
10)
if [ ".${var1}" = . ]
then
echo ${n} "Do your system support utime.h (default:${UTIME_H}) ? ${c}"
read var1 dummy
fi
case "${var1:-${DIRENT}}" in
y|Y|yes|YES) UTIME_H=yes; ;;
*) UTIME_H=no; ;;
esac
;;
11)
case "${var1}" in
dirent)
DIRENT=yes; SYSDIR=no;
;;
sys/dir)
DIRENT=no; SYSDIR=yes;
;;
*)
echo ${n} "Do your system support dirent.h (default:${DIRENT}) ? ${c}"
read var1 dummy
case "${var1:-${DIRENT}}" in
y|Y|yes|YES) DIRENT=yes; SYSDIR=no; ;;
*) DIRENT=no; SYSDIR=no; ;;
esac
if [ ${DIRENT} = no ]
then
echo ${n} "Do your system support sys/dir.h (default:${SYSDIR}) ? ${c}"
read var1 dummy
case "${var1:-${SYSDIR}}" in
y|Y|yes|YES) DIRENT=no; SYSDIR=yes; ;;
*) DIRENT=no; SYSDIR=no; ;;
esac
fi
;;
esac
;;
12)
if [ ".${var1}" = . ]
then
echo "If your system don't need word allignment for words (like 80386)"
echo "compress can use this fact to by faster. If your are not sure type y"
echo ${n} "Must words start at a even address (default:${NOALLIGN}) ? ${c}"
read var1 var2 varr
fi
if [ ".${var2}" = . ]
then
echo ${n} "Byteorder on your system (default:${BYTEORDER}) ? ${c}"
read var2 varr
fi
case "${var1}" in
n|no|N|NO) var1=no; ;;
*) var1=yes; ;;
esac
NOALLIGN="${var1:-${NOALLIGN}}"
BYTEORDER="${var2:-${BYTEORDER}}"
;;
d|D)
echo "Testing the system to find out what kind of system we have."
BINDIR=/usr/bin
MANDIR=/usr/man/man1
DIRENT=no
SYSDIR=no
UTIME_H=no
IBUFSIZ=2048
OBUFSIZ=2048
USERMEM=0
REGISTERS=2
LSTAT=no
CCOPT='-O'
LBOPT=
EXTRA=
[ -f /usr/include/sys/dir.h ] && { SYSDIR=yes; }
[ -f /usr/include/dirent.h ] && { DIRENT=yes; }
[ -f /usr/include/utime.h ] && { UTIME_H=yes; }
[ -d /usr/local/bin ] && { BINDIR=/usr/local/bin; }
[ -d /usr/local/man ] && { BINDIR=/usr/local/man/man1; }
[ -f /usr/bin/compress ] && { BINDIR=/usr/bin; }
if [ ".${CC}" = . ]
then
echo ${n} "Find compiler. Compiler is: ${c}"
echo 'main() {return 0;}' >/tmp/sh$$.c
for cc in cc gcc
do
if ${cc} -c /tmp/sh$$.c >/dev/null 2>&1
then
rm -f sh$$.o
CC=${cc}
echo ${CC}
break
fi
done
if [ ".${CC}" = . ]
then
echo "Can't file one of the standaard compilers. Give C Compiler name"
echo ${n} "C Compiler : ${c}"
read CC dummy
fi
fi
echo ${n} "Test best buffer size: ${c}"
cat >/tmp/sh$$.c <<!
#include <stdio.h>
main()
{
int size;
size = 1024;
#ifdef BUFSIZ
if (size < BUFSIZ) size = BUFSIZ;
#endif
if (sizeof(int)<4) size = 2048;
printf("%d\n", size);
return 0;
}
!
${CC} /tmp/sh$$.c && IBUFSIZ=`./a.out`
rm -f /tmp/sh$$.c a.out
OBUFSIZ=${IBUFSIZ}
echo "${IBUFSIZ}"
echo ${n} "Test byte order of system: ${c}"
cat >/tmp/sh$$.c <<!
main()
{
long test;
extern int write();
test = 0x31323334L;
write(1, (char *)&test, 4);
return 0;
}
!
${CC} /tmp/sh$$.c && BYTEORDER=`./a.out`
BYTEORDER="${BYTEORDER:-0000}"
echo ${BYTEORDER}
rm -f /tmp/sh$$.c a.out
echo ${n} "Test word allignment. Must words be allign: ${c}"
cat >/tmp/sh$$.c <<!
sig() {exit(1);}
main()
{
int i;
char bfr1[6];
char bfr2[6];
long test;
extern int write();
for (i = 1 ; i <= 15 ; ++i)
signal(i, sig);
bfr1[0]=' ';bfr1[1]='1';bfr1[2]='2';
bfr1[3]='3';bfr1[4]='4';bfr1[5]=' ';
bfr2[0]='X';bfr2[1]='X';bfr2[2]='X';
bfr2[3]='X';bfr2[4]='X';bfr2[5]='X';
test = *(long *)(bfr1+1);